package ai.yunxi.im.server;

import ai.yunxi.im.common.config.BeanConfiguration;
import ai.yunxi.im.common.utils.SpringBeanFactory;
import ai.yunxi.im.common.utils.ZKUtil;
import ai.yunxi.im.server.utils.RegisterToZk;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author 小五-云析学院
 * @date 2020-06-21 13:57
 * @remark
 */
@SpringBootApplication
@Import({SpringBeanFactory.class, ZKUtil.class, BeanConfiguration.class})
public class IMServerApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(IMServerApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
//        new ThreadPoolExecutor()
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.execute(new RegisterToZk());

//        Thread thread = new Thread();
//        thread.setName("im-server-register-thread");
//        thread.start();
    }
}
